package controller.bulkUpload;

import java.io.Serializable;
import java.util.List;

import persistence.ProfileDAO;

import dto.search.ProfileDTO;
import entity.Profile;

public class BulkUploadController implements Serializable {

	private static final long serialVersionUID = -4284441352196215570L;

	public void upload(List<ProfileDTO> list) throws Exception {
		ProfileDAO dao = new ProfileDAO();
		for (ProfileDTO dto : list) {
			Profile profile = new Profile();
			profile.setAboutself(dto.getAboutself());
			profile.setAddress(dto.getAddress());
			profile.setAge(dto.getAge());
			profile.setBirthplace(dto.getBirthplace());
			profile.setComplexion(dto.getComplexion());
			profile.setDob(dto.getDob());
			profile.setEducation(dto.getEducation());
			profile.setEducationlevel(dto.getEducationlevel());
			profile.setEmail(dto.getEmail());
			profile.setFathername(dto.getFathername());
			profile.setFatherprofession(dto.getFatherprofession());
			profile.setFirstname(dto.getFirstname());
			profile.setGender(dto.getGender());
			profile.setHeight(dto.getHeight());
			profile.setIncome(Double.parseDouble(dto.getIncome()));
			profile.setLastname(dto.getLastname());
			profile.setMaritalstatus(dto.getMaritalstatus());
			profile.setMaternalgotram(dto.getMaternalgotram());
			profile.setMobileno(dto.getMobileno());
			profile.setMothername(dto.getMothername());
			profile.setMotherprofession(dto.getMotherprofession());
			profile.setOccupation(dto.getOccupation());
			profile.setPaternalgotram(dto.getPaternalgotram());
			profile.setRasi(dto.getRasi());
			profile.setStar(dto.getStar());
			profile.setTenantid(dto.getTenantid());
			dao.persist(profile);
		}
	}
}
